class Person {
    name: string;
    age: number
    constructor(name: string, age: number) {
        this.name = name;
        this.age = age;
    }
    jump(a: string): string {
        return a + this.name
    }
    static run(x: number): number {
        return x
    }


}

let anni = new Person('anni', 10);
console.log(anni.jump('aabbcc'));
console.log(Person.run(6));

interface Anima {
    sound(str: string): string,
    weight(num: number): number
}

interface Anima1 {
    name(str: string): string
}
class Cat implements Anima, Anima1 {
    sound(a: string): string {
        return a
    }
    weight(num: number): number {
        return num
    }
    name(str: string): string {
        return str
    }
}

let kitty = new Cat();
console.log(kitty);
console.log(kitty.sound('小猫咪'));
console.log(kitty.sound('喵喵叫'));


interface DogInP {
    sound (str:string) :string
}

interface DogInC {
    run(num:number) :number
}
interface NewIn extends DogInP,DogInC {

}
class Dog implements NewIn {
    sound (str:string):string {
        return str
    }
    run(num:number) :number {
        return num 
    }
}

let dahuang = new Dog()
console.log(dahuang.sound('汪汪汪狗叫'));
console.log(dahuang.run(100));


class Students extends Person {
    sex:string;
    constructor(name:string,age:number,sex:string) {
        super(name,age);
        this.sex = sex
    }
    jump (a:string) :string {
        return super.jump(a);
    }
}
let ta = new Students('ta',20,'男');
console.log(ta.jump('帅气'));

class Book {
    public name :string;
    private price : string;
    protected pages : number ;
    constructor(name:string,price:string,pages:number) {
        this.name = name;
        this.price = price;
        this.pages = pages;
    }
    sayBookName():string {
        console.log(this.price);
        console.log(this.pages);
        return this.name
        
        
    }
}

let hongloumeng = new Book ('hongloumeng','200元',1500);
console.log(hongloumeng.name);
console.log(hongloumeng);
console.log(hongloumeng.sayBookName());


class HouBook extends Book {
    constructor(name:string,price:string,pages:number) {
        super(name,price,pages);
    }
    testPrice() {
        console.log(this.name);
        console.log(this.pages);
        
        
    }
}

let jingdong = new HouBook ('jingdong','20',100);
console.log(jingdong.testPrice());





export {
    anni,
}
